package com.qianke.common;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class NetWorkUtils {

    public static String getHostIp() {
        try {
            InetAddress netAddress = InetAddress.getLocalHost();
            return netAddress.getHostAddress();
        } catch (UnknownHostException e) {
            throw new RuntimeException("getHostAddress error!");
        }
    }

    public static String getHostName() {
        try {
            InetAddress netAddress = InetAddress.getLocalHost();
            return netAddress.getHostName();
        } catch (UnknownHostException e) {
            throw new RuntimeException("getHostName error!");
        }

    }
}
